home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
TEMP
/
GNU
/
flex
/
Uservariab
< prev
next >
Wrap
Text File
|
1995-06-28
|
3KB
|
70 lines
User variables
Previous: <Miscellaneous=>Miscellane> * Next: <YACC interface=>YACCinterf> * Up: <Top=>!Root>
#Wrap on
{fH3}Values available to the user{f}
This section summarizes the various values available to
the user in the rule actions.
#Indent +4
- {fEmphasis}char \*yytext{f} holds the text of the current token.
It may be modified but not lengthened (you cannot
append characters to the end).
If the special directive {fEmphasis}%array{f} appears in the
first section of the scanner description, then
{fCode}yytext{f} is instead declared {fEmphasis}char yytext[YYLMAX]{f},
where {fCode}YYLMAX{f} is a macro definition that you can
redefine in the first section if you don't like the
default value (generally 8KB). Using {fEmphasis}%array{f}
results in somewhat slower scanners, but the value
of {fCode}yytext{f} becomes immune to calls to {fEmphasis}input(){f} and
{fEmphasis}unput(){f}, which potentially destroy its value when
{fCode}yytext{f} is a character pointer. The opposite of
{fEmphasis}%array{f} is {fEmphasis}%pointer{f}, which is the default.
You cannot use {fEmphasis}%array{f} when generating C++ scanner
classes (the {fEmphasis}-+{f} flag).
- {fEmphasis}int yyleng{f} holds the length of the current token.
- {fEmphasis}FILE \*yyin{f} is the file which by default {fCode}flex{f} reads
from. It may be redefined but doing so only makes
sense before scanning begins or after an EOF has
been encountered. Changing it in the midst of
scanning will have unexpected results since {fCode}flex{f}
buffers its input; use {fEmphasis}yyrestart(){f} instead. Once
scanning terminates because an end-of-file has been
seen, you can assign {fCode}yyin{f} at the new input file and
then call the scanner again to continue scanning.
- {fEmphasis}void yyrestart( FILE \*new\_file ){f} may be called to
point {fCode}yyin{f} at the new input file. The switch-over
to the new file is immediate (any previously
buffered-up input is lost). Note that calling
{fEmphasis}yyrestart(){f} with {fCode}yyin{f} as an argument thus throws
away the current input buffer and continues
scanning the same input file.
- {fEmphasis}FILE \*yyout{f} is the file to which {fEmphasis}ECHO{f} actions are
done. It can be reassigned by the user.
- {fCode}YY\_CURRENT\_BUFFER{f} returns a {fCode}YY\_BUFFER\_STATE{f} handle
to the current buffer.
- {fCode}YY\_START{f} returns an integer value corresponding to
the current start condition. You can subsequently
use this value with {fCode}BEGIN{f} to return to that start
condition.
#Indent